let currentPath = process.argv.splice(2)[0].replace('\\','/').replace('\\','/');
const chokidar = require('chokidar');
const superagent = require('superagent');
const fs = require('fs');
const { Subject } = require('rxjs');
const { debounceTime } = require('rxjs/operators');
const http = require('https');
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
let sub = new Subject();
class ListPage {
    constructor(dom) {
        this.dom = dom;
    }
    getUrls() {
        console.log(this.dom)
    }
}
chokidar.watch('./src').on('all', (event, path) => {
    // let dd = http.get('https://www.9f743d42e7c897ee.com/mlvideolist.x?tagid=3', function (req, res) {
    //     let html = '';
    //     req.on('data', function (data) {
    //         html += data;
    //     });
    //     req.on('end', function () {
            
    //         // const dom = new JSDOM(html);
    //         // console.log(dom)
    //         // // let result = JSON.parse(html);
    //         // let listDom = dom.window.document.querySelector("content");
    //         // let listPage = new ListPage();
    //         // listPage.getUrls();
    //     });
    //     req.on('close', () => {
    //         console.log(html);
    //         // const dom = new JSDOM(html);
    //         // let list = dom.window.document.querySelector("content");
    //         // console.log(list)
    //     })
    //     req.on("error", function (err) {
    //         console.log(err);
    //     });
    // });
    // dd.on('error', (err) => {
    //     console.log(err)
    // })
    const https = require('https');

    // let res =http.get('https://www.9f743d42e7c897ee.com/mlvideolist.x?tagid=3', (req) => {
    // console.log('statusCode:', req.statusCode);
    // console.log('headers:', req.headers);

    //     let html = '';
    //     req.on('data', function (data) {
    //         html += data;
    //     });
    //     req.on('close', () => {
    //         console.log(html);
            
    //         // const dom = new JSDOM(html);
    //         // let list = dom.window.document.querySelector("content");
    //         // console.log(list)
    //     })

    // })
    // res.on('error', (e) => {
    //     console.error(e);
    // });
    // res.end()
    superagent.get('https://www.9f743d42e7c897ee.com/mlvideolist.x?tagid=3').then(res => {
        console.log(res);
    });
});